Correctly refetch/invalidate stackframes/scopes/variables #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue breakdown
Prior to this PR, our approach was to invalidate variables and attempt to refetch existing ones based on known container references. This method proved problematic because all objects (stack frames, scopes, variables) should be considered stale after an object modification.
This was the primary reason why, when trying to refetch variables with current container references, we often failed to see nested variables appear. The issue was twofold: not only did reusing stale container references prevent nested variables from showing up, but we also used the variable reference as unique id to determine what variable to show, which changes when an object was modified or when moving to the next frame.
To address this issue, I've implemented two key changes:
I modified the unique ID used to determine which entry to display. Now, we only use the variable's depth and name, as these two attributes remain constant over time.
I altered the variable fetching mechanism. We now retrieve all previously opened variables, eliminating the need to repeatedly click open the same variable during step debugging.
These changes should significantly improve the reliability and user experience of the debugging process.
Example
Before
Screen.Recording.2024-10-25.at.19.49.00.mov
After
Screen.Recording.2024-10-25.at.19.38.35.mov